package com.mcp.converter.domain.report;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 不兼容分析报告类
 * 包含不兼容分析的详细信息
 */
public class IncompatibilityReport {
    
    /**
     * 报告ID
     */
    private String reportId;
    
    /**
     * 生成时间
     */
    private Date generationTime;
    
    /**
     * 原始SQL
     */
    private String originalSQL;
    
    /**
     * 转换后SQL
     */
    private String convertedSQL;
    
    /**
     * 是否完全兼容
     */
    private boolean compatible;
    
    /**
     * 不兼容点数量
     */
    private int incompatiblePointCount;
    
    /**
     * 已转换数量
     */
    private int convertedCount;
    
    /**
     * 不兼容详情列表
     */
    private List<IncompatibilityReportDetail> details;
    
    /**
     * 附加属性
     */
    private Map<String, Object> attributes;
    
    // Constructors
    
    public IncompatibilityReport() {
        this.generationTime = new Date();
        this.details = new java.util.ArrayList<>();
        this.attributes = new java.util.HashMap<>();
    }
    
    public String getReportId() {
        return reportId;
    }
    
    public void setReportId(String reportId) {
        this.reportId = reportId;
    }
    
    public Date getGenerationTime() {
        return generationTime;
    }
    
    public void setGenerationTime(Date generationTime) {
        this.generationTime = generationTime;
    }
    
    public String getOriginalSQL() {
        return originalSQL;
    }
    
    public void setOriginalSQL(String originalSQL) {
        this.originalSQL = originalSQL;
    }
    
    public String getConvertedSQL() {
        return convertedSQL;
    }
    
    public void setConvertedSQL(String convertedSQL) {
        this.convertedSQL = convertedSQL;
    }
    
    public boolean isCompatible() {
        return compatible;
    }
    
    public void setCompatible(boolean compatible) {
        this.compatible = compatible;
    }
    
    public int getIncompatiblePointCount() {
        return incompatiblePointCount;
    }
    
    public void setIncompatiblePointCount(int incompatiblePointCount) {
        this.incompatiblePointCount = incompatiblePointCount;
    }
    
    public int getConvertedCount() {
        return convertedCount;
    }
    
    public void setConvertedCount(int convertedCount) {
        this.convertedCount = convertedCount;
    }
    
    public List<IncompatibilityReportDetail> getDetails() {
        return details;
    }
    
    public void setDetails(List<IncompatibilityReportDetail> details) {
        this.details = details;
    }
    
    public Map<String, Object> getAttributes() {
        return attributes;
    }
    
    public void setAttributes(Map<String, Object> attributes) {
        this.attributes = attributes;
    }
    
    /**
     * 添加不兼容详情
     * @param detail 不兼容详情
     */
    public void addDetail(IncompatibilityReportDetail detail) {
        if (detail != null) {
            this.details.add(detail);
        }
    }
    
    /**
     * 添加属性
     * @param key 属性键
     * @param value 属性值
     */
    public void addAttribute(String key, Object value) {
        this.attributes.put(key, value);
    }
    
    /**
     * 获取属性
     * @param key 属性键
     * @return 属性值
     */
    public Object getAttribute(String key) {
        return this.attributes.get(key);
    }
    
    /**
     * 获取报告摘要
     * @return 报告摘要
     */
    public ReportSummary getSummary() {
        ReportSummary summary = new ReportSummary();
        summary.setReportId(this.reportId);
        summary.setGenerationTime(this.generationTime);
        summary.setCompatible(this.compatible);
        summary.setIncompatiblePointCount(this.incompatiblePointCount);
        summary.setConvertedCount(this.convertedCount);
        return summary;
    }
    
    /**
     * 报告摘要类
     */
    public static class ReportSummary {
        private String reportId;
        private Date generationTime;
        private boolean compatible;
        private int incompatiblePointCount;
        private int convertedCount;
        
        public String getReportId() {
            return reportId;
        }
        
        public void setReportId(String reportId) {
            this.reportId = reportId;
        }
        
        public Date getGenerationTime() {
            return generationTime;
        }
        
        public void setGenerationTime(Date generationTime) {
            this.generationTime = generationTime;
        }
        
        public boolean isCompatible() {
            return compatible;
        }
        
        public void setCompatible(boolean compatible) {
            this.compatible = compatible;
        }
        
        public int getIncompatiblePointCount() {
            return incompatiblePointCount;
        }
        
        public void setIncompatiblePointCount(int incompatiblePointCount) {
            this.incompatiblePointCount = incompatiblePointCount;
        }
        
        public int getConvertedCount() {
            return convertedCount;
        }
        
        public void setConvertedCount(int convertedCount) {
            this.convertedCount = convertedCount;
        }
    }
}
